package com.code.day16.d_lambda;

import java.util.Arrays;
import java.util.function.Supplier;

public class TestSupplier {
    public static void main(String[] args) {

        method(new Supplier<Integer>() {
            @Override
            public Integer get() {
                int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
                Arrays.sort(arr);
                return arr[arr.length-1];
            }
        });

        System.out.println("==============================");

        method(() -> {
                int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
                Arrays.sort(arr);
                return arr[arr.length-1];
            }
        );

    }




    public static void method(Supplier<Integer> supplier){
        int i = supplier.get();
        System.out.println(i+1);

    }
}
